package com.szrt.day20170418.ch06.random;


import java.util.Random;

import org.junit.Test;

public class RandomTest {
	
	@Test
	public void randomTest03() throws Exception {
		
		
		//1 得到随机数的对象
		Random random = new Random();
		
		double x = random.nextDouble();
		System.out.println(x);
		
		
		
	}
	
	@Test
	public void randomTest02() throws Exception {
		
		//2
		String[] class1704 ={"贾梦菊","靳志辉","何小强","罗智壕","张嘉源","周驰"};
		
		//1 得到随机数的对象
		Random random = new Random();
		
		//  0<=index<6
		int index = random.nextInt(class1704.length);
		System.out.println(index);
		
		System.out.println(class1704[index]);
		
	}
	
	
	
	@Test
	public void randomTest01() throws Exception {
		
		//1 得到随机数的对象
		Random random = new Random();
		
		//0<=x<100
		for(int i =0;i<5;i++){
			int x =random.nextInt(100);
			System.out.println(x);
		}
		
	}

}
